//
//  UIScrollViewEx.m
//  yuimall_Iphone
//
//  Created by Gang.Wang on 12-4-27.
//  Copyright (c) 2012年 yuike. All rights reserved.
//

#import "UIScrollViewEx.h"


@interface UIScrollViewEx (private) 
- (void) privateInit;
@end

@implementation UIScrollViewEx

@synthesize respondTouchsMethod;

- (id) init
{
    self = [super init];
    if (self) {
        [self privateInit];
    }
    return self;
}

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        [self privateInit];
    }
    return self;
}


- (void) privateInit
{
    if (self->bInited) {
        return;
    }
    
    self.respondTouchsMethod = FALSE;
    
    self->bInited = TRUE;
}


#pragma mark -
#pragma mark -touchMethods

- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
    [super touchesBegan:touches withEvent:event];
    
    if (!self.respondTouchsMethod) {
        return;
    }
    
    if ( !self.dragging )
    {
        [[self nextResponder] touchesBegan:touches withEvent:event];
    }
}

- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesMoved:touches withEvent:event];
    if (!self.respondTouchsMethod) {
        return;
    }
    
    if ( !self.dragging )
    {
        [[self nextResponder] touchesBegan:touches withEvent:event];
    }

}

- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
{
    [super touchesEnded:touches withEvent:event];
    if (!self.respondTouchsMethod) {
        return;
    }
    
    if ( !self.dragging )
    {
        [[self nextResponder] touchesEnded:touches withEvent:event];
    }
}

@end
